package org.nf.box.web.controller;

import org.nf.box.common.result.ResultVO;
import org.springframework.http.HttpStatus;

/**
 * @Author lzp
 * @Date 2024-11-26
 */
public class BaseController {

    public <T> ResultVO<T> success(T data) {
        ResultVO<T> resultVO = new ResultVO<>();
        resultVO.setCode(HttpStatus.OK.value());
        resultVO.setData(data);
        return resultVO;
    }
    public <T> ResultVO<T> success() {
        ResultVO<T> resultVO = new ResultVO<>();
        resultVO.setCode(HttpStatus.OK.value());
        return resultVO;
    }
    public <T> ResultVO<T> error(int code,String message) {
        ResultVO<T> resultVO = new ResultVO<>();
        resultVO.setCode(code);
        resultVO.setMessage(message);
        return resultVO;
    }
}
